#!/usr/bin/env node

const http=require('http'),
      url=require('url'),
      qs=require('querystring');





http.createServer((req,res)=>{
  //解析url
  console.log(req.url);
  
  //调用url.parse方法，将url地址解析为对象的形式，键值对

  let addr=url.parse(req.url);
 
  //打印路径名
  console.log(addr.pathname);
  
  //打印查询字符

  console.log(addr.query);


  console.log(addr.pathname.split('/'));

  console.log(qs.parse(addr.query));
  req.end('ok');








}).listen(8080);
